import React from 'react';
import {inject,Provider} from 'mobx-react';
import {withRouter, Redirect} from 'react-router-dom';
import {Layout} from 'antd';


import Store from '@/store/editor';

import EditorHeader from './Ui/Editor/EditorHeader';
import PageMain from './Ui/Editor/PageMain';
import PageProperty from './Ui/Editor/PageProperty';

import '@/css/pages/Editor.css';

const {Sider} = Layout;

const editorStore = new Store();

@inject('store')
@withRouter
export default class Editor extends React.Component{
  render() {
    const {login} = this.props.store.loginStatus;
    
    if (!login) {
      return <Redirect to={{
        pathname: '/login',
        state:{from: '/editor'}
      }} />;
    }
    return (<Provider editorStore={editorStore}><Layout className="page-editor">
      <EditorHeader />
      <Layout>
        <Sider>
          dd
        </Sider>
        <PageMain />
        <PageProperty />
      </Layout>
    </Layout></Provider>)
  }
}
